草庐IT

java treeset 抛出 illegalArgumentException : key out of range

全部标签

解决报错 java.lang.IllegalArgumentException: Cannot format given Object as a Date

报错原因:我们在SimpleDateFormat.format转化时间格式的时候,传入的值无法转换成date而报的错我的代码大概就是下面这种LocalDatenow=LocalDate.now();Stringformat1=newSimpleDateFormat("yyyy-MM-dd").format(now);发现SimpleDateFormat.format方法并不适用于LocalDate类型,不然就会报此错误;这个错误的解决方法都是一样,先把时间转换成date类型,再去调用此方法进行格式化publicfinalStringBufferformat(Objectobj,StringBu

android - Eclipse 调试器自行停止,没有任何可抛出的

EclipseDebugger突然停止不抛出任何东西:privatevoidopenChannelsListActivity(){try{IntentgridListIntent=newIntent();//thepauseisonthefollowinglinegridListIntent.setClass(this,ChannelsListActivity.class);startActivity(gridListIntent);}catch(Throwablee){ErrorMessage.outputMessageByName("channels_list_activity_c

Android 菜单,在运行 onPrepareOptionsMenu 时抛出 IndexOutOfBoundsException

当我尝试更新菜单中的MenuItem时,我收到了IndexOutOfBoundsException。我在xml中添加了menu_item,当enable()==false时我可以看到它。我的代码:publicbooleanonPrepareOptionsMenu(Menumenu){if(enable()){MenuItemmenuItem=menu.getItem(R.id.menu_item);menuItem.setEnabled(true);}returnsuper.onPrepareOptionsMenu(menu);}如何处理问题?干杯。 最佳答

java - Facebook App Event sdk 4.38.0 在 ViewHierarchy.setAppearanceOfView 中抛出 NPE

我在使用facebooksdk的其中一个应用程序中遇到问题。将sdk从4.27.0升级到4.38.0后,fabric开始记录这个致命异常。我不知道它何时或如何发生,因为我无法自己复制它。也许你们中的一些人在升级facebookSDK后遇到了这个问题。FatalException:java.lang.NullPointerException:Attempttoinvokevirtualmethod'booleanandroid.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat,int,java.io.Outpu

android - WebView 抛出 Receiver not registered : android. widget.ZoomButtonsController

我看到这个异常在我的应用程序中偶尔出现(在野外​​)。WebView用于显示jpg(使用Android版本/设备的缩放/滚动功能,而不是重新发明轮子并执行所有反射操作)。我不知道为什么最终会出现这个异常。基本上我只能想到一个Androidbug。我做什么(GUI线程中的所有内容):首先显示缩略图作为预览设置getSettings().setBuiltInZoomControls(false)加载常规图片时,改为显示该图片设置getSettings().setBuiltInZoomControls(true)为什么要打开/关闭ZoomControls:缩略图不应该是可缩放的,因为一旦常规

android - 从 Android USB 附件读取会抛出 ENODEV IOException

因此,我已经实现了AndroidUSBAccessoryAPI,这样我就可以将手机插入运行Linux的笔记本电脑,并将手机置于USBAccessory模式。然后我可以访问配件,打开它,然后开始阅读对它的写作。我的代码看起来与thedocumentation中的示例几乎相同.主要区别在于我使用单独的读取和写入方法并通过JNI从native代码访问它们。这就是它变得有趣的地方。在成功读取/写入一两秒后,从我的笔记本电脑进行的批量传输写入开始出现超时错误,然后在Android中对USB附件的读取调用抛出一个带有ENODEV错误代码的IOException。这是电缆仍然连接并且UsbManag

android - 为什么 MediaRecorder 的 start() 方法会抛出 IllegalStateException?

我正在尝试录制音频,但MediaRecorder类的start()方法抛出IllegalStateException。我使用以下代码:MediaRecorderrecorder=newMediaRecorder();recorder.setAudioSource(MediaRecorder.AudioSource.MIC);recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);recorder.s

android - createBitmap --- java.lang.IllegalArgumentException : x must be < bitmap. 宽度()

我在截图和创建带裁剪图片的位图时出错下面是我的代码Viewv1=mKittyBGLayer.getRootView();v1.setDrawingCacheEnabled(true);Bitmapsource=v1.getDrawingCache();intwidth=source.getWidth();intheight=source.getHeight();System.out.println("vListView:-"+vListView.getWidth());System.out.println("hListView:-"+hListView.getHeight());Sys

android.os.TransactionTooLargeException 随机抛出

我从我的一个实时应用程序中看到了很多错误报告,原因是这个异常:java.lang.RuntimeException:Addingwindowfailedatandroid.view.ViewRootImpl.setView(ViewRootImpl.java:513)atandroid.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259)atandroid.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)atandroid.app.ActivityT

android - 将云消息传递 api 添加到 GoogleApiClient 时出现 IllegalArgumentException

我正在Android应用程序中设置GoogleCloudMessaging。一开始,我初始化GoogleApiClient以检查Play服务是否可用:mGoogleApiClient=newGoogleApiClient.Builder(this).addConnectionCallbacks(this).addOnConnectionFailedListener(this).build();尝试运行它会产生IllegalArgumentException:mustcalladdApi()toaddatleastoneAPI,所以我还需要添加GCMApi,但老实说我在文档中找不到它.像